package ch.jamme.conf;


/**
 * Defines a strategy to decide if a given object property should be mapped as an attribute
 * of the xml element describing the containing object or as another element inside it. 
 * Be aware that if you map a field as an attribute, jamme assumes that it is a primitive value 
 * and it writes the field value using the provided object conversion strategy instead of further introspect it.
 * @author Mario Fusco
 */
public interface FieldBindingStrategy {

	/**
	 * Returns true if the field having the given name and value and belonging to the given Class should
	 * be marshalled as an attribute of the containing element instead of as an inner Element
	 * The name used is the one resulting from the translation defined by the FieldNamingStrategy (if any)
	 * @param containingClass The Class containing the value to be marshalled
	 * @param name The name of the value to be marshalled
	 * @return True if the field with the given name and value and belonging to the given Class should be marshalled as an attribute
	 */
	boolean bindAsAttribute(Class<?> containingClass, String name);
}
